package com.cencat.user.dto;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import jakarta.validation.constraints.Min;

/**
 * 权限创建DTO
 * @author cencat
 * @since 2024-01-01
 */
@Data
@Schema(description = "权限创建DTO")
public class PermissionCreateDTO {

    @Schema(description = "父权限ID", example = "0")
    private Long parentId = 0L;

    @NotBlank(message = "权限名称不能为空")
    @Size(min = 2, max = 50, message = "权限名称长度必须在2-50之间")
    @Schema(description = "权限名称", example = "用户管理", required = true)
    private String permissionName;

    @NotBlank(message = "权限编码不能为空")
    @Size(min = 2, max = 100, message = "权限编码长度必须在2-100之间")
    @Schema(description = "权限编码", example = "user:manage", required = true)
    private String permissionCode;

    @NotNull(message = "权限类型不能为空")
    @Schema(description = "权限类型（1-菜单，2-按钮，3-接口）", example = "1", required = true)
    private Integer permissionType;

    @Schema(description = "权限描述", example = "用户管理权限")
    @Size(max = 200, message = "权限描述长度不能超过200")
    private String description;

    @Schema(description = "权限路径", example = "/user/manage")
    @Size(max = 200, message = "权限路径长度不能超过200")
    private String permissionPath;

    @Schema(description = "权限图标", example = "user")
    @Size(max = 50, message = "权限图标长度不能超过50")
    private String icon;

    @Schema(description = "组件路径", example = "@/views/user/index")
    @Size(max = 200, message = "组件路径长度不能超过200")
    private String component;

    @Schema(description = "路由参数", example = "{\"id\": 1}")
    @Size(max = 500, message = "路由参数长度不能超过500")
    private String routeParams;

    @Schema(description = "是否外链（0-否，1-是）", example = "0")
    private Integer isExternal = 0;

    @Schema(description = "是否缓存（0-否，1-是）", example = "1")
    private Integer isCache = 1;

    @Schema(description = "是否显示（0-否，1-是）", example = "1")
    private Integer isVisible = 1;

    @Schema(description = "排序", example = "1")
    @Min(value = 0, message = "排序不能小于0")
    private Integer sortOrder = 0;

    @NotNull(message = "租户ID不能为空")
    @Schema(description = "租户ID", example = "1", required = true)
    private Long tenantId;

    @Schema(description = "创建人ID", example = "1")
    private Long createBy;

    @Schema(description = "备注", example = "权限备注信息")
    @Size(max = 500, message = "备注长度不能超过500")
    private String remark;
}